import Jwt from '../lib/AuthJwt';
import User from '../models/User';

export default {
    Query: {
        getUser: (root, args, context) => {
            return {id: 1, name: 'LinHan', email: '754060604@qq.com'};
        }
    },
    Mutation: {
        async loginByUsername (root, args, context) {
            let token = Jwt.token('sa3tgd2svw3rf2ds23rd32fds3');
            return {token};
        },
        register (root, args, context) {
            let user = new User().create(args);
            // console.info(user);
            return user;
        }
    }
};